home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2005 October
/
PCWOCT05.iso
/
Software
/
FromTheMag
/
Syn Text Editor 2.1.0.46
/
synsetup-2.1.0.46.exe
/
{app}
/
templates
/
Pascal
/
Pascal GUI.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2003-08-13
|
2KB
|
80 lines
{Description: Pascal GUI Program|}
{
Created: {$DateTime} by {$UserName}
$Id: Pascal\040GUI.pas,v 1.1.2.3 2003/08/13 00:38:45 neum Exp $
}
program {$FileTitleNoExt};
{$APPTYPE GUI}
uses
{ If you're using Delphi add the Messages Unit to your Uses clause }
Windows,
SysUtils;
var
{ Global Variables }
WClass: TWndClass;
Handle: HWND; { Handle of the Mainwindow }
Msg: TMsg;
const
AppTitle = '{$FileTitleNoExt}';
ClassName = '{$FileTitleNoExt}WindowClass';
function WndProc(HWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
{ Window procedure, add here your message handlers }
case Msg of
WM_DESTROY:
begin
PostQuitMessage(0);
WndProc := 0;
end;
WM_COMMAND:
begin
{ To Do: Add your command Message handlers here }
end;
{ To Do: Add other Message handlers here }
else
WndProc := DefWindowProc(HWnd, Msg, WParam, LParam);
end;
end;
procedure ProcessMessages;
begin
{ Wait for Messages }
while GetMessage(Msg, 0, 0, 0) do begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;
begin
with WClass do begin
Style := CS_HREDRAW or CS_VREDRAW;
lpfnWndProc := @WndProc;
cbClsExtra := 0;
cbWndExtra := 0;
hInstance := HInstance;
hIcon := LoadIcon(0, IDI_APPLICATION);
hCursor := LoadCursor(0, IDC_ARROW);
hbrBackground := COLOR_WINDOW + 1;
lpszMenuName := PChar(AppTitle);
lpszClassName := PChar(ClassName);
end;
RegisterClass(WClass);
Handle := CreateWindow(PChar(ClassName), PChar(AppTitle), WS_OVERLAPPEDWINDOW, 0,
0, 100, 100, 0, 0, HInstance, nil);
if Handle = 0 then begin
MessageBox(0, 'Unable to create Window.', PChar(AppTitle), MB_ICONSTOP + MB_OK);
end else begin
{ Add here your other initialization stuff here }
ShowWindow(Handle, SW_SHOW);
ProcessMessages;
DestroyWindow(Handle);
end;
end.